package com.study.demoevent.event.listener;

import com.study.demoevent.event.dto.MyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @Name: MyListener
 * @Description: java类作用描述
 * @Author: yn
 * @CreateDate: 2022/9/5 16:51
 * @Remark: 特殊说明
 * @Version: 1.0
 */
@Component
public class MyListener {
	@Async
	@EventListener(MyEvent.class)
	public void listen(MyEvent myEvent) throws InterruptedException {
		TimeUnit.SECONDS.sleep(10);
		System.out.println(myEvent);
	}
}
